A data processor requires a variety of shift operations to implement its instruction set. The shift operations can include left shifts, right shifts, and rotates. The shifts can be arithmetic or logical, which determines how bits at either end of the operand are handled. Each shift or rotate operation has a variable length. Which bit is shifted into a given bit position is determined by the type of shift operation. There is generally a tradeoff involved in designing circuitry to implement shift and rotate operations on an operand. The area on the integrated circuit used for the circuitry to perform the operations affects the performance of the operation, measured in number of clock cycles to complete the operation.
At one extreme, a barrel shifter performs a full matrix of operations on an operand. For example, if the barrel shifter is 32 bits wide, each of the 32 bits is selectively coupled directly to each of the other 31 bits. Which bits are coupled together for an operation is determined by the length and direction of the operation being performed. The barrel shifter maximizes the performance of the shifter, but also consumes a maximum of space. At the other extreme, a simple shifter shifts only one bit at a time. To implement shifts of larger lengths, a control section must use consecutive one-bit shift operations until the specified length is reached. This type of shifter uses much less area than the barrel shifter, but performance is greatly diminished. An intermediate shifter was taught by Chas F. Studor and Robert Skruhak in U.S. Pat. No. 5,099,445. This shifter performs left and right shifts not only by one, but also by an arbitrary number, such as four, to provide a good compromise between size and speed. However, the area-speed tradeoff remains a significant problem in data processor design.
G. Wolrich et al. in U.S. Pat. No. 4,887,232 entitled "Apparatus and Method for Performing a Shift Operation in a Multiplier Array Circuit" disclose a shift apparatus for aligning operands in a floating point system prior to addition or subtraction. Wolrich et al. make use of an existing array multiplier to perform this denormalization shift quickly without an additional shifter such as a barrel shifter. The apparatus disclosed by Wolrich et al. is used only for denormalization shifts and thus only programmably performs right shifts. What is needed, however, is a shifting apparatus which both consumes very little circuit area and also is able to perform all needed shift operations.